﻿#include "GameEditor.h"

#include "ExampleLayer.h"
#include "core/log/LogSystem.h"

namespace Editor
{
	GameEditor::GameEditor(Engine::GameEngine* engine)
	{
		this->engine = engine;
		ASSERT(engine, "引擎初始化失败！")

		// Todo:添加需要的editor layer
		this->engine->PushLayer(new ExampleLayer());

		LOG_TRACE("GameEditor 启动")
	}

	GameEditor::~GameEditor()
	{
		LOG_TRACE("GameEditor 关闭")
	}

	void GameEditor::Run() const
	{
		bool shouldClose = false;

		while (!shouldClose)
		{
			const float deltaTime = engine->CalculateDeltaTime();
			shouldClose = !this->engine->TickOneFrame(deltaTime);
		}
	}
}
